//
// When color definition differs for dark and light variant,
// it gets @if ed depending on $variant
//

@function shellopacity($c, $a) {
  @return scale-color($c, $alpha: percentage(-1 + $a));
}

//
// Foreground colors
//

$fg_color: if($variant == light, shellopacity(black, 0.87), #EAEAEA);
$secondary_fg_color: shellopacity($fg_color, 0.87);
$tertiary_fg_color: shellopacity($fg_color, 0.54);
$insensitive_fg_color: shellopacity($fg_color, 0.28);
$insensitive_secondary_fg_color: shellopacity($secondary_fg_color, 0.28);

$selected_fg_color: #FFFFFF;
$secondary_selected_fg_color: shellopacity($selected_fg_color, 0.87);

//
// OSD Foreground colors
//

$osd_fg_color: #EAEAEA;
$osd_secondary_fg_color: shellopacity($osd_fg_color, 0.87);
$osd_tertiary_fg_color: shellopacity($osd_fg_color, 0.54);

$insensitive_osd_fg_color: shellopacity($osd_fg_color, 0.28);
$insensitive_osd_secondary_fg_color: shellopacity($osd_secondary_fg_color, 0.28);

//
// Accent colors
//

$accent_color: #555555;
@if $color =='ruby'     { $accent_color: #F0544C; }
@if $color =='doder'    { $accent_color: #4586D8; }
@if $color =='beryl'    { $accent_color: #2EB398; }
@if $color =='amethyst' { $accent_color: #AB47BC; }
@if $color =='black'    { $accent_color: #555555; }

$accent_label_color: if($variant == light, mix($accent_color, $fg_color, 80%), mix($accent_color, $fg_color, 60%));
$secondary_accent_color: shellopacity($accent_color, 0.87);
$secondary_accent_label_color: shellopacity($accent_label_color, 0.87);
$insensitive_accent_label_color: shellopacity($accent_label_color, 0.28);

$accent_fill_color: shellopacity($accent_color, 0.25);
$accent_semi_fill_color: shellopacity($accent_color, 0.12);
$accent_outline_fill_color: shellopacity($accent_color, 0.2);

$inverted_accent_label_color: mix($accent_color, $osd_fg_color, 60%);
$inverted_secondary_accent_label_color: shellopacity($inverted_accent_label_color, 0.87);

//
// Background colors
//

$bg_color: if($variant =='dark', if($color == 'ruby' or $color == 'black' or $color == 'white', #282828, #2c2e33), #F5F5F5);
$base_color: if($variant =='dark', if($color == 'ruby' or $color == 'black' or $color == 'white', #303030, #313338), #FFFFFF);
$secondary_base_color: mix($base_color, $bg_color, 50%);
$secondary_dark_color: if($variant =='dark', if($color == 'ruby' or $color == 'black' or $color == 'white', #303030, #30333b), #EEEEEE);
$light_color: if($variant =='dark', if($color == 'ruby' or $color == 'black' or $color == 'white', #383838, #36393e), #FCFCFC);

$fill_color: shellopacity($fg_color, 0.25);
$semi_fill_color: shellopacity($fg_color, 0.12);
$hidden_fill_color: rgba(0, 0, 0, 0.01);
$menuentry_hidden_fill_color: if($variant == light, rgba(255, 255, 255, 0.01), rgba(0, 0, 0, 0.01));

$selected_bg_color: $accent_color;

$outline_fill_color: shellopacity($fg_color, 0.2);
$insensitive_outline_fill_color: shellopacity($outline_fill_color, 0.28);


//
// OSD Background colors
//

$osd_bg_color: #222222;
@if $color == 'ruby' or $color == 'black' { $osd_bg_color: #222222; }
@if $color == 'doder' or $color == 'beryl' or $color == 'amethyst' { $osd_bg_color: #212329; }

$osd_fill_color: shellopacity($osd_fg_color, 0.25);
$osd_semi_fill_color: shellopacity($osd_fg_color, 0.12);

$osd_indicator_color: $selected_bg_color;

$osd_outline_fill_color: shellopacity($osd_fg_color, 0.2);
$insensitive_osd_outline_fill_color: shellopacity($osd_outline_fill_color, 0.28);

//
// Misc colors
//

$borders_color: if($variant == light, shellopacity(#000000, 0.12), shellopacity(#000000, 0.15));
$solid_light_borders_color: if($variant == light, #E2E2E2, #212121);
$borders_edge: shellopacity(#000000, 0.08);
$top_hilight: $borders_edge;
$borders_highlight: shellopacity(#FFFFFF, 0.08);
$menu_highlight: if($variant == light, $base_color, mix($secondary_base_color, #FFFFFF, 98%));
$insensitive_borders_color: $borders_color;

$link_color: #4285F4;
$link_visited_color: #E040FB;

$link_label_color: if($variant == light, $link_color, mix($link_color, $fg_color, 60%));
$link_visited_label_color: if($variant == light, $link_visited_color, mix($link_visited_color, $fg_color, 60%));

$warning_color: #FF6D00;
$error_color: #DD2C00;
$success_color: #00C853;

$suggested_color: #4CAF50;
$destructive_color: #FF5252;


//
// Panel colors
//

$panel_bg_color: $osd_bg_color;
$panel_transparent_color: shellopacity($panel_bg_color, 0.0);
$panel_hidden_fill_color: shellopacity($panel_bg_color, 0.01);
$panel_secondary_fill_color: shellopacity($panel_bg_color, 0.87);
$panel_tertiary_fill_color: shellopacity($panel_bg_color, 0.54);

